# Contributor: <xmingske@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=py3-gunicorn
_pkgname=gunicorn
pkgver=21.2.0
pkgrel=1
pkgdesc="WSGI HTTP Server for UNIX"
url="https://gunicorn.org/"
arch="noarch"
license="MIT"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-pytest-cov py3-aiohttp py3-gevent"
subpackages="$pkgname-pyc"
source="$_pkgname-$pkgver.tar.gz::https://github.com/benoitc/gunicorn/archive/$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces=py-gunicorn # Backwards compatibility
provides=py-gunicorn=$pkgver-r$pkgrel # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest \
		--deselect tests/workers/test_geventlet.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
47c21293bd5340e43074c87694d13241b2867437ad993b204ee4bd21ea923350763a424b3f7ce59737b10cd526d12127b1ae95ef60410eca9924605b522d637c  gunicorn-21.2.0.tar.gz
"
